package com.qfedu.yanglao20admin.comment.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qfedu.yanglao20.common.CommonResult;
import com.qfedu.yanglao20.common.param.PageParam;
import com.qfedu.yanglao20admin.comment.entity.ReviewConfiguration;
import com.qfedu.yanglao20admin.comment.param.ReviewConfigurationParam;
import com.qfedu.yanglao20admin.comment.service.ReviewConfigurationService;
import com.qfedu.yanglao20admin.health.entity.HealthData;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "评述配置")
@RestController
@RequestMapping("reviewConfiguration")
public class ReviewConfigurationController {
    @Resource
    private ReviewConfigurationService reviewConfigurationService;
    /**
     * 分页查询
     *
     * @param
     * @param
     * @return 查询结果
     */

    @ApiOperation(value = "分页展示评述配置", notes = "分页展示评述配置")
    @GetMapping("/page")
    public CommonResult<PageParam> page(ReviewConfigurationParam param) {
  Page<ReviewConfiguration> reviewConfigurationPage=reviewConfigurationService.pageReview(param);
        return CommonResult.success(reviewConfigurationPage);
    }

    @ApiOperation(value = "根据id删除评述配置", notes = "根据id删除评述配置")
    @GetMapping("/delete")
    public void delete(Integer id){
        reviewConfigurationService.deletebyid(id);
    }
    @ApiOperation(value = "添加评述配置", notes = "添加评述配置")
    @PostMapping("/insert")
    public void insert(ReviewConfiguration reviewConfiguration){
        reviewConfigurationService.insertrever(reviewConfiguration);
    }

    @ApiOperation(value = "根据id获取评述配置", notes = "根据id获取评述配置")
    @GetMapping("/query")
    public ReviewConfiguration query(Integer id){
        return  reviewConfigurationService.queryByid(id);
    }

    @ApiOperation(value = "更新评述配置", notes = "更新评述配置")
    @PostMapping("/update")
    public void update(ReviewConfiguration reviewConfiguration){
        reviewConfigurationService.update(reviewConfiguration);
    }
}
